package com.tanhua.server.controller;

import com.tanhua.dubbo.server.pojo.AnswerList;
import com.tanhua.dubbo.server.pojo.Paper;
import com.tanhua.server.service.TestSoulService;
import com.tanhua.server.vo.QueryResultList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class TestSoulController {

    @Autowired
    private TestSoulService testSoulService;
    /**
     * 问卷列表
     * @return
     */
    @GetMapping
    public List<Paper> findQuestionList(){
        return testSoulService.findQuestionList();
    }

    /**
     * 提交问卷
     * @param map
     * @return
     */
    @PostMapping
    public ResponseEntity commitPaper(@RequestBody Map<String,List<AnswerList>> map){
        return testSoulService.commitPaper(map);
    }

    /**
     * 查看结果
     * @param reportId
     * @return
     */
    @GetMapping("/report/{id}")
    public ResponseEntity report(@PathVariable("id") String reportId){
        return testSoulService.report(reportId);
    }
}
